from mmdet.apis import init_detector, inference_detector, show_result_pyplot
import warnings

warnings.filterwarnings("ignore")


config_file = '/home/deepin/Documents/ji_pingtai/mmdetection/work_dir/swin_3.py'
# 下载地址

checkpoint_file = '/home/deepin/Documents/ji_pingtai/mmdetection/work_dir/latest.pth'
device = 'cuda:0'

# 初始化检测器
model = init_detector(config_file, checkpoint_file, device=device)
# 推理演示图像
img = '/home/deepin/Documents/ji_pingtai/mmdetection/data/coco/train2017/3.jpg'
result = inference_detector(model, img)

show_result_pyplot(model, img, result, score_thr=0.9) # 先训练起来，到时在想box框的问题吧